package com.zhengshang.api.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhengshang.api.mapper.AppGasBrandTypeMapper;
import com.zhengshang.api.domain.AppGasBrandType;
import com.zhengshang.api.service.IAppGasBrandTypeService;

/**
 * 油站类型Service业务层处理
 * 
 * @author zhengshang
 * @date 2021-04-17
 */
@Service
public class AppGasBrandTypeServiceImpl implements IAppGasBrandTypeService 
{
    @Autowired
    private AppGasBrandTypeMapper appGasBrandTypeMapper;

    /**
     * 查询油站类型
     * 
     * @param gasBrandType 油站类型ID
     * @return 油站类型
     */
    @Override
    public AppGasBrandType selectAppGasBrandTypeById(String gasBrandType)
    {
        return appGasBrandTypeMapper.selectAppGasBrandTypeById(gasBrandType);
    }

    /**
     * 查询油站类型列表
     * 
     * @param appGasBrandType 油站类型
     * @return 油站类型
     */
    @Override
    public List<AppGasBrandType> selectAppGasBrandTypeList(AppGasBrandType appGasBrandType)
    {
        return appGasBrandTypeMapper.selectAppGasBrandTypeList(appGasBrandType);
    }

    /**
     * 新增油站类型
     * 
     * @param appGasBrandType 油站类型
     * @return 结果
     */
    @Override
    public int insertAppGasBrandType(AppGasBrandType appGasBrandType)
    {
        if (appGasBrandTypeMapper.selectAppGasBrandTypeById(appGasBrandType.getGasBrandType()) == null) {
            return appGasBrandTypeMapper.insertAppGasBrandType(appGasBrandType);
        } else {
            return appGasBrandTypeMapper.updateAppGasBrandType(appGasBrandType);
        }
    }

    /**
     * 修改油站类型
     * 
     * @param appGasBrandType 油站类型
     * @return 结果
     */
    @Override
    public int updateAppGasBrandType(AppGasBrandType appGasBrandType)
    {
        return appGasBrandTypeMapper.updateAppGasBrandType(appGasBrandType);
    }

    /**
     * 批量删除油站类型
     * 
     * @param gasBrandTypes 需要删除的油站类型ID
     * @return 结果
     */
    @Override
    public int deleteAppGasBrandTypeByIds(String[] gasBrandTypes)
    {
        return appGasBrandTypeMapper.deleteAppGasBrandTypeByIds(gasBrandTypes);
    }

    /**
     * 删除油站类型信息
     * 
     * @param gasBrandType 油站类型ID
     * @return 结果
     */
    @Override
    public int deleteAppGasBrandTypeById(String gasBrandType)
    {
        return appGasBrandTypeMapper.deleteAppGasBrandTypeById(gasBrandType);
    }
}
